package com.golang.activity.repository;

import com.ruoyi.system.domain.Activity;
import com.ruoyi.system.domain.ActivityProcess;
import com.ruoyi.system.domain.ActivityTag;
import com.ruoyi.system.domain.ActivityTicket;
import com.ruoyi.system.mapper.ActivityMapper;
import com.ruoyi.system.mapper.ActivityProcessMapper;
import com.ruoyi.system.mapper.ActivityTagMapper;
import com.ruoyi.system.mapper.ActivityTicketMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class ActivityRepository {

    @Resource
    ActivityMapper activityMapper;

    @Resource
    ActivityProcessMapper activityProcessMapper;

    @Resource
    ActivityTagMapper activityTagMapper;

    @Resource
    ActivityTicketMapper activityTicketMapper;


    public int insertActivity(Activity entity) {
        return activityMapper.insertActivity(entity);
    }

    public int updateActivity(Activity entity) {
        return activityMapper.updateActivity(entity);
    }

    public int insertActivityProcess(ActivityProcess entity) {
        return activityProcessMapper.insertActivityProcess(entity);
    }

    public int insertActivityTag(ActivityTag entity) {
        return activityTagMapper.insertActivityTag(entity);
    }

    public int insertActivityTicket(ActivityTicket entity) {
        return activityTicketMapper.insertActivityTicket(entity);
    }


    public Activity queryActivity(String activityId) {

        Activity query = new Activity();
        query.setActivityId(activityId);
        return activityMapper.selectActivityList(query).get(0);
    }


    public List<ActivityProcess> queryActivityProcess(String activityId) {

        ActivityProcess query = new ActivityProcess();
        query.setActivityId(activityId);
        return activityProcessMapper.selectActivityProcessList(query);
    }

    public List<ActivityTag> queryActivityTag(String activityId) {

        ActivityTag query = new ActivityTag();
        query.setActivityId(activityId);
        return activityTagMapper.selectActivityTagList(query);
    }


    public List<ActivityTicket> queryActivityTicket(String activityId) {

        ActivityTicket query = new ActivityTicket();
        query.setActivityId(activityId);
        return activityTicketMapper.selectActivityTicketList(query);
    }


}
